<template>
  <div>
    <el-dialog title="订单详情" :visible.sync="dialogVisible" width="30%" :before-close="closeDialog">
      <div v-if="orderDetail && orderDetail.number" class="order-detail">
        <div class="title">订单信息</div>
        <div class="row-wrapper">
          <div class="row">
            <ul>
              <li>订单号：{{ orderDetail.number }}</li>
              <li>用户：{{ orderDetail.user_nickname }}</li>
              <li>下单时间：{{ orderDetail.created_at }}</li>
              <li class="pay">实付总积分：{{ orderDetail.score }}积分</li>
            </ul>
          </div>
        </div>
      </div>
      <div class="goods-info">
        <div class="title">商品信息</div>
        <div class="row-wrapper">
          <div class="row">
            <ul>
              <li>商品名称：{{ orderDetail.goods_name }}</li>
              <li>积分：{{ orderDetail.goods_score }}积分</li>
              <li>数量：×1</li>
            </ul>
          </div>
        </div>
      </div>
      <div class="goods-info">
        <div class="title">收货人信息</div>
        <div class="row-wrapper">
          <div class="row">
            <ul>
              <li>收货人姓名：{{ orderDetail.receiver_name }}</li>
              <li>联系电话：{{ orderDetail.receiver_phone }}</li>
              <li>收货人地址：{{ orderDetail.receiver_address }}</li>
            </ul>
          </div>
        </div>
      </div>
      <div class="goods-info" v-if="orderDetail.delivery_type == 2">
        <div class="title">物流信息</div>
        <div class="row-wrapper">
          <div class="row">
            <ul>
              <li>商品名称：{{ orderDetail.goods_name }}</li>
              <li>类型：{{ orderDetail.express_company }}</li>
              <li>单号：{{ orderDetail.express_no }}</li>
              <li class="pay">用户备注：{{ orderDetail.description }}</li>
            </ul>
          </div>
        </div>
      </div>
      <div class="goods-info" v-if="orderDetail.delivery_type == 1">
        <div class="title">领取时间</div>
        <div class="row-wrapper">
          <div class="row">
            <ul>
              <li v-if="orderDetail.updated_at">领取时间：{{orderDetail.updated_at.date}}</li>
            </ul>
          </div>
        </div>
      </div>
    </el-dialog>
  </div>
</template>
<script>
export default {
  props: {
    orderDetail: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      dialogVisible: false
    };
  },
  methods: {
    show() {
      this.dialogVisible = true;
    },
    hide() {
      this.dialogVisible = false;
    },
    closeDialog() {
      this.$emit("closeDialog");
      this.dialogVisible = false;
    }
  }
};
</script>
<style lang="scss" scoped>
.el-dialog__wrapper /deep/ .el-dialog {
  min-width: 1300px;
  .el-dialog__body {
    padding-top: 0 !important;
  }
}
.el-dialog__wrapper /deep/ .el-dialog__close {
  position: absolute;
  top: -55px;
  font-size: 24px;
  line-height: 24px;
  font-weight: bold;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  background-color: rgba(255, 255, 255, 1);
}
.order-detail,
.goods-info {
  margin-top: 23px;
  .title {
    height: 26px;
    line-height: 26px;
    color: rgba(68, 68, 68, 1);
    font-size: 16px;
    text-align: center;
    font-family: Roboto;
    text-align: left;
    font-weight: bold;
  }
  .row-wrapper {
    background-color: rgba(250, 250, 250, 1);
    border: 1px solid rgba(235, 238, 245, 1);
    padding: 23px 38px;
    box-sizing: border-box;
    margin-top: 8px;
    .row {
      ul {
        display: flex;
        justify-content: space-between;
        li {
          flex-basis: 30%;
          line-height: 20px;
          color: rgba(102, 102, 102, 1);
          font-size: 14px;
          text-align: center;
          font-family: Roboto;
          list-style: none;
          text-align: left;
          margin-left: 20px;
          white-space: nowrap;
          &.pay {
            color: red;
          }
        }
      }
    }
  }
}
.goods-info {
  .row-wrapper {
    .row {
      ul {
        li {
          flex-basis: 20%;
        }
      }
    }
  }
}
</style>
